<div class="topPaginator">
    <span class="signsName">Checkout</span>
</div>
<div id="signShow">
    <div id="signShowContent">
        <div class="blocHead">
            <div class="rightArrowLeft"></div>
            <span class="blueMessege">Confirm Order and Enter Payment to Finalize Order!</span>
        </div>
        <div id="orderRewie">
            <table>
                <thead>
                    <tr>
                        <td class="itemName">Item</td>
                        <td class="checkBoxes">Quantity</td>
                        <td class="checkBoxes">Remove</td>
                        <td class="amountBoxes">Amount</td>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <? //print_r($buyItem);exit;?>
                        <?foreach($buyItem as $key=>$value):?>
                                <td class="itemName"><?=$value['name'];?></td>
                                <td class="checkBoxes">
                                    <input type="text" value="1" class="quantyty" />
                                </td>
                                <td class="checkBoxes">
                                    <input type="checkbox" value="1" class="quantyty" />
                                </td>
                                <td class="amountBoxes">
                                    <?='$'.$value['price'];?>
                                </td>
                        <?endforeach;?>
                    </tr>
                    <tr>
                        <td class="subtotalTd">Subtotal:</td>
                        <td></td><td></td>
                        <td class="amountBoxes"><?='$'.$buyItem[0]['price'];?></td>
                    </tr>
                    <tr>
                        <td class="subtotalTd"><?=$buyItem[0]['delivery'];?>:</td>
                        <td></td><td></td>
                        <td class="amountBoxes"><?='$'.$buyItem[0]['deliveryCost'];?></td>
                    </tr>
                    <tr>
                        <td class="subtotalTd">Total:</td>
                        <td></td><td></td>
                        <td class="amountBoxes">$ <?=$buyItem[0]['deliveryCost']+$buyItem[0]['price'];?></td>
                    </tr>
                </tbody>
            </table>
            <div class="signShowButton">
                <div class="rightArrowLeft"></div>
                <a href="#">
                    <span class="blueMessege">PLACE ORDER</span>
                </a>
            </div>
        </div>
        <div class="clear">&nbsp;</div>
    </div>
</div>
<h1>Checkout</h1>
<? $total = 0; ?>
<? if (count($items)): ?>
	<table class="threew25s comment">
			<tr>
				<th class="w50 left padding10">
					Item
				</th>
				<th style="width: 15%" class="left padding10">
					Quantity
				</th>
				<th style="width: 15%" class="left padding10">
					Price
				</th>
				<th style="width: 20%" class="left padding10">
					Total price
				</th>
			</tr>
		<? foreach ($items as $item): ?>
			<? $total += (round(((float)$item['price'] * (int)$item['quantity']) * 100) / 100) ?>
			<tr>
				<td class="w50 darkBlue padding10">
					<?=Html::anchor(
						Request::$controller . 'deleteItem/' . $item['section'] . '/' . $item['token'] . '/',
						'<img src="/images/icons/small/remove.png" width="12" height="12" alt="Remove form cart"/>'
					)?>
					<?=Html::chars($item['name'])?>
				</td>
				<td style="width: 15%" class="padding10">
					<?=$item['quantity']?>
				</td>
				<td style="width: 15%" class="padding10">
					$<?=$item['price']?>
				</td>
				<td style="width: 20%" class="padding10">
					$<?=(round(((float)$item['price'] * (int)$item['quantity']) * 100) / 100)?>
				</td>
			</tr>
		<? endforeach ?>
		<? if (isset($delivery)): ?>
			<tr>
				<td class="padding10 right" colspan="3">
				<script type="text/javascript">
					function calculateDelivery(el)
					{
						var total = document.getElementById('totalAmount');
						var delivery = document.getElementById('customer-delivery'); if (el.checked) {delivery.value = 1; total.innerHTML = '$<?=$total + $delivery?>';} else {delivery.value = 0; total.innerHTML = '$<?=$total?>';}
					}
				</script>
					Overnight delivery: <input type="checkbox" onclick="calculateDelivery(this)" />
				</td>
				<td style="width: 20%" class="padding10">
					 $<?=$delivery?>
				</td>
			</tr>
		<? endif ?>
		<tr>
			<td class="padding10 bold right" colspan="3">
				Total:
			</td>
			<td style="width: 20%" class="padding10 bold">
				<span id="totalAmount">$<?=$total?></span>
			</td>
		</tr>
	</table>
<? endif ?>
<p>
	<a href="/" class="large darkBlue">&larr; Continue shopping</a>
</p>
<p class="large">Fill up this fields to proceed to the PayPal secure checkout</p>
<? if (isset($form)): ?>
	<?=$form?>
<? endif?>
